import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/main.css'
import './assets/fonts/iconfont.css'
import axios from 'axios'
import ZkTable from 'vue-table-with-tree-grid'
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

Vue.use(VueQuillEditor, /* { default global options } */ )

Vue.component('tree-table', ZkTable)


Vue.prototype.axios = axios;

axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
    // 给请求拦截器添加token，
axios.interceptors.request.use(config => {
        config.headers.Authorization = sessionStorage.getItem('token');
        // console.log(config);
        return config;
    })
    // 设置响应拦截
axios.interceptors.response.use(res => {
    return res.data
})
Vue.config.productionTip = false

Vue.filter('datematfor', (time) => {
    let date = new Date(time);
    let y = date.getFullYear().toString().padStart(2, 0);
    let m = (date.getMonth() + 1).toString().padStart(2, 0);
    let d = date.getDay().toString().padStart(2, 0);
    let times = y + '-' + m + '-' + d
    return times
})

new Vue({
    router,
    render: h => h(App)
}).$mount('#app')